#ifndef LOCK_H_
#define LOCK_H_

#include <iostream>
#include <Windows.h>

//lock class
class Lock
{
public:
	Lock()
	{
		::InitializeCriticalSection( &_criticalSection );
	}
	virtual ~Lock()
	{
		::DeleteCriticalSection( &_criticalSection );
	}

	void iLock()
	{
		::EnterCriticalSection( &_criticalSection );
	}

	void iUnLock()
	{
		::LeaveCriticalSection( &_criticalSection );
	}

private:
	CRITICAL_SECTION	_criticalSection;
};
#endif